package com.gitee.wsl.ext.bitcode

fun Int.numberOfLeadingZeros() = this.countLeadingZeroBits()
fun Long.numberOfLeadingZeros() = this.countLeadingZeroBits()
fun Short.numberOfLeadingZeros() = this.countLeadingZeroBits()
fun Byte.numberOfLeadingZeros() = this.countLeadingZeroBits()

//numberOfLeadingZeros
fun Int.Companion.numberOfLeadingZeros(value:Int) = value.countLeadingZeroBits()
fun Long.Companion.numberOfLeadingZeros(value:Long) = value.countLeadingZeroBits()
fun Short.Companion.numberOfLeadingZeros(value:Short) = value.countLeadingZeroBits()
fun Byte.Companion.numberOfLeadingZeros(value:Byte) = value.countLeadingZeroBits()

//numberOfTrailingZeros
fun Int.Companion.numberOfTrailingZeros(value:Int) = value.countTrailingZeros()
fun Long.Companion.numberOfTrailingZeros(value:Long) = value.countTrailingZeros()


//numberOfTrailingZerosBits
fun Int.Companion.numberOfTrailingZerosBits(value:Int) = value.countTrailingZeroBits()
fun Long.Companion.numberOfTrailingZerosBits(value:Long) = value.countTrailingZeroBits()
fun Long.Companion.numberOfTrailingZerosBits(value:Short) = value.countTrailingZeroBits()
fun Byte.Companion.numberOfTrailingZerosBits(value:Byte) = value.countTrailingZeroBits()

//highestOneBit
fun Int.Companion.highestOneBit(value:Int) = value.takeHighestOneBit()
fun Long.Companion.highestOneBit(value:Long) = value.takeHighestOneBit()
fun Long.Companion.highestOneBit(value:Short) = value.takeHighestOneBit()
fun Byte.Companion.highestOneBit(value:Byte) = value.takeHighestOneBit()

//lowestOneBit
fun Int.Companion.lowestOneBit(value:Int) = value.takeLowestOneBit()
fun Long.Companion.lowestOneBit(value:Long) = value.takeLowestOneBit()
fun Long.Companion.lowestOneBit(value:Short) = value.takeLowestOneBit()
fun Byte.Companion.lowestOneBit(value:Byte) = value.takeLowestOneBit()